<?php ob_start(); ?>
<?php  
    //register.php  
   
	require_once 'model/global.inc.php';    
?>   
<html>  
<head>  
    <title>Registration</title> 
    <link href="view/css/styles.css" type="text/css" rel="stylesheet"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
    <script type="text/javascript" src="view/js/js.js"></script>
    <script type="text/javascript" src="view/js/jquery-1.2.6.min.js"></script>
    <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>

</head>  
<script>
  /*  $(document).ready(function() {
        $("#country_id").change(function() {
            var city = document.getElementById("city");
            city.style.visibility = "visible";
            var select; 
            select = $("#country_id option:selected").text();
            var newString = select.split(' ').join('');
            $.ajax({                                      
                url: '../controller/product/select_city.php?file='+newString,                  //the script to call to get data          
                data: "",                        //you can insert url argumnets here to pass to api.php for example "id=5&parent=6"
                dataType: 'json',                //data format      
                success: function(data)          //on recieve of reply
                {
                   var textoption = "";
                   for (var i = 0; i < data.length; i++) { 
                        var item = data[i];
                        textoption += item['data.country_name'];                      
                   } 
                   alert(textoption);
                } 
            });
        });
 });*/
</script>
<body>    
    <form id="frmlogin" name="frmlogin" action="" method="post" >  
    
        <table class="form">
            <tr>
                <td colspan="2">
                    <div class="titleAdmin">
                         <b>Sign Up</b>
                    </div>
                </td>
            </tr>
            <tr>
                <td class ="txt">
                     Firstname:
                </td>
                <td class="input">
                    <input id="firstname" type="text" value="" name="firstname" size="30" />
                </td>
                <td id="firstname" style="color:red">
                    
                </td>
            </tr>
            <tr>
                <td class ="txt">
                      Lastname:
                </td>
                <td class="input">
                     <input type="text" value="" name="lastname" size="30" />
                </td>
            </tr>
            <tr>
                <td class ="txt">
                     Email:
                </td>
                <td class="input">
                     <input id="email" type="text" value="" name="email" onBlur="AjaxFunction(this.value);"  size="30"/>
                </td>
                <TD id="msg" style="color: red;">*</TD>
            </tr>
            <tr>
                <td class ="txt">
                     Confirm Email:
                </td>
                <td class="input">
                   <input id="email-conf" type="text" value="" name="email-confirm" onkeyup="checkEmail(); return false;" size="30" />
                </td>
                <TD id="inf_from" style="color: red;">*</TD>
            </tr>
            <tr>
                <td class ="txt">
                     Country:
                </td>
                <td class="input">                   
                   <select name="country" id="country_id">
                    <option value="" selected>- country -</option>
                        <?php

                        $result = mysql_query("SELECT * FROM tblcountry where parent = 0 order by country_name");

                        while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { ?>
                                <option value="<?php echo $row["country_name"] ?>">
                            <?php echo $row["country_name"] . '<br />'; ?></option>
                        <?php 
                        }
                        ?>
                    </select>
                </td>
                <!--<td>                   
                   <select name="city" id="city" style="visibility: hidden;">
                    <option value="" selected>- city -</option>                      
                    </select>
                </td>-->
            </tr>
            <tr>
                <td class ="txt">
                     Password:
                </td>
                <td>
                  <input id="pass" type="password" value="" name="password" onkeyup="passwordStrength(this.value,document.getElementById('inf_pass'),document.getElementById('inf_pass'))" size="30" />
                </td>
                <TD id="inf_pass" style="color: red;">*</TD>
            </tr>
            <tr>
                <td class ="txt">
                     Password (confirm): 
                </td>
                <td>
                   <input id="conf" type="password" value="" name="password-confirm"  onkeyup="checkPass(); return false;"  size="30"/>
                </td>
                <TD id="inf_conf" style="color: red;">*</TD>
            </tr>
            <tr>
               
                <td colspan="2">
                    <input id="agree" type="checkbox" name="agree" value="agree"  size="30"> I have read and agree...<br>
                </td>
                <TD id="inf_checked" style="color: red;">*</TD>
            </tr><p></p>
            <tr>
               
                <td colspan="2">
                    <center><input type="submit" value="Register" name="submit" onclick="chechbox();" class="button" size="30"/></center>
                </td>
            </tr>
        </table>	 
    </form>  
    <div id="lblMessage">
    </div>
<script type="text/javascript">
    $(document).ready(function(){
		$("#frmlogin").validate({			
			submitHandler: function(form) {
				// do other stuff for a valid form
				$.post('controller/login/register_control.php', $("#frmlogin").serialize(), function(data) {
                                    $('#lblMessage').html(data);
                                   
				});
                                
			}
                         
		});
                
	});
</script>
</body>  
</html>  